﻿namespace MhAdmin.Web.Core;

/// <summary>
/// 规则日志控制器
/// </summary>
[ApiDescriptionSettings("System", Tag = "规则日志")]
[Route("/dev/rulesLog")]
[RolePermission]
public class RulesLogController : IDynamicApiController
{
    private readonly IRulesLogService _rulesLogService;

    public RulesLogController(IRulesLogService rulesLogService
    )
    {
        this._rulesLogService = rulesLogService;
    }

    #region Get请求

    /// <summary>
    /// 规则日志分页查询
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpGet("page")]
    [DisplayName("规则日志分页查询")]
    public async Task<dynamic> Page([FromQuery] RulesLogPageInput input)
    {
        return await _rulesLogService.Page(input);
    }

    /// <summary>
    /// 规则日志列表查询
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpGet("list")]
    [DisplayName("规则日志列表查询")]
    public async Task<dynamic> List([FromQuery] RulesLogPageInput input)
    {
        return await _rulesLogService.List(input);
    }

    /// <summary>
    /// 规则日志详情
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpGet("detail")]
    [DisplayName("规则日志详情")]
    public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
    {
        return await _rulesLogService.Detail(input);
    }

    #endregion Get请求

    #region Post请求

    /// <summary>
    /// 添加规则日志
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("add")]
    [DisplayName("添加规则日志")]
    public async Task Add([FromBody] RulesLogAddInput input)
    {
        await _rulesLogService.Add(input);
    }

    /// <summary>
    /// 修改规则日志
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("edit")]
    [DisplayName("修改规则日志")]
    public async Task Edit([FromBody] RulesLogEditInput input)
    {
        await _rulesLogService.Edit(input);
    }

    /// <summary>
    /// 删除规则日志
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("delete")]
    [DisplayName("删除规则日志")]
    public async Task Delete([FromBody] List<BaseIdInput> input)
    {
        await _rulesLogService.Delete(input);
    }

    #endregion Post请求
}
